<div id="search" class="green-box">
    <div class="box-title">
        <div class="wrapper"><?php echo $this->translate()->widget('title') ?></div>
        <div class="conner"></div>
    </div>
    <div class="box-container">
        <form name="frmSearch" id="frmSearch" method="post" action="<?php echo $this->url(array(), 'product_product_search')?>">
            <label><?php echo $this->translate()->widget('key_word') ?></label>
            <input type="text" name="keyword" value="" size="30" id="keyword"/>
            <label><?php echo $this->translate()->widget('category') ?></label>
            <select name="categoryId" id="search-category">
                <option value="">...</option>
                <?php
                if ($this->categories) {
                    $count = count($this->categories);
                    $rightStack = array();
                    for ($i = 0; $i < $count; $i++) {
                        while (count($rightStack) > 0 && $rightStack[count($rightStack) - 1] < $this->categories[$i]->rht) {
                            array_pop($rightStack);
                        }
                        ?>
                        <option value="<?php echo $this->categories[$i]->id ?>">
                            <?php echo str_repeat('--', count($rightStack)) . $this->categories[$i]->name; ?>
                        </option>
                        <?php
                        $rightStack[] = $this->categories[$i]->rht;
                    }
                }
                ?>

            </select>

            <input type="submit" name="submit" id="submit" value="<?php echo $this->translate()->widget('button_search')?>"/>
        </form>
        <script type="text/javascript">
            $(document).ready(function(){
                $('#frmSearch').submit(function(){
                    if($('#keyword').val() == ''){
                        alert('<?php echo $this->translate()->widget('key_word_required')?>');
                        return false;
                    }
                });
            })
        </script>
    </div>
</div>